<?php
require_once "db.php";
session_start();
$id = db_escape($_POST['movie']);
$date = date("Y-m-d");
$content = "<div id='one-movie-program'>
				<form id='one-program' method='post' action='oneProgramContent.php'>
					<select id='one-program-sel-cin' name='oneprogram'>
						<option value='choose_cinema'>Choose cinema</option>";
$availability_query_text = "SELECT cinema_idcinema FROM cinema_has_movies WHERE movies_idmovies='$id'";
$availability_query = db_query($availability_query_text);
while ($row = mysqli_fetch_assoc($availability_query)) {
	$cin_id = $row['cinema_idcinema'];
	$get_cin_query_text = "SELECT cinema_name FROM cinema WHERE idcinema='$cin_id'";
	$get_cin_query = db_query($get_cin_query_text);
	$row_cin = mysqli_fetch_assoc($get_cin_query);
	$content .= "<option value='".$row_cin['cinema_name']."'>".$row_cin['cinema_name']."</option>";
}
$content .= "</select><input type='date' name='oneprogramdate' value='".$date."'>
			<input type='submit' id='one-program-but' name='oneProgram' value='Show'/>
			</form></div>";
$_SESSION['movie'] = $id;
echo $content;
